Skip to content

Switch to ρ(z) for the penalties - #102

Merged
timholy merged 4 commits into
mainfrom
teh/rho-penalty
Oct 27, 2026
Merged

timholy merged 4 commits into
mainfrom
teh/rho-penalty

Conversation

@timholy

@timholy timholy commented Oct 27, 2026

Copy link
Copy Markdown
Member

This switches from a penalty on the coverage ratio r to a penalty on the slacks z=-log(r). Given that it's convexity in z that matters, this makes the theory a lot cleaner. Sadly, it's a breaking change for the package, and since 1.x is registered this ushers in v2, only a few days after v1 appeared.

Give the row reference log-scales (logref), the estimated plain
Sinkhorn rate (μ2), the LSQR rotation diagonal (rdiag, rdiagbar), and
the preconditioner ridge (ridge) descriptive names. Write the PowerMean
penalty in the log slack as ρ (_powermean_ρ) and the augmented-
Lagrangian per-entry term as ℓ.

Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
Use ρ for the penalty argument and for the penalty in docstrings and
comments across src/, ext/, and test/. The LSQR iteration keeps its
own ϕ and ϕbar, which are unrelated to the penalty.

Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
Built-in penalties are now functions of the log slack
z = log(a[i]*b[j]) - log|A[i,j]| instead of the ratio
r = |A[i,j]|/(a[i]*b[j]):

    AbsLog{p}:    ρ(z) = |z|^p
    AbsLinear{p}: ρ(z) = |1 - exp(-z)|^p
    PowerMean{p}: ρ(z) = (exp(-p z) - 1 + p z)/p

A user-defined AbstractCoverPenalty must likewise be callable on z.

cover_objective sums only over the nonzero entries of A and never
evaluates the penalty on a zero entry. A nonzero entry over a zero
scale product has z = -Inf, where every built-in penalty is infinite.
For AbsLinear, zero entries no longer add a constant 1 each, and the
Ipopt soft-cover models drop the same constant, so the objective they
report matches cover_objective.

Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
State the cover objective as a sum of ρ(z) over the nonzero entries of
A, with z = log(a[i]*b[j]) - log|A[i,j]|, and name the AbsLog cases by
their ℓ_p norms. Write the solver docstrings, the cover_transversal
target objective, the documentation pages, and the README in the same
terms.

Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.34%. Comparing base (a2edaad) to head (dbbbe92).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #102      +/-   ##
==========================================
- Coverage   98.34%   98.34%   -0.01%     
==========================================
  Files          25       25              
  Lines        7550     7542       -8     
==========================================
- Hits         7425     7417       -8     
  Misses        125      125              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@timholy
timholy merged commit ddd338b into main Oct 27, 2026
7 checks passed
@timholy
timholy deleted the teh/rho-penalty branch October 27, 2026 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant